////////////////////////////////////////////////////////////////////////////////
// ======================= BROOOOOOOODUL MINIGUN =============================//
// =================== re-written by Dinosaur Nerd ===========================//
// ===================== Use it however you want =============================//
////////////////////////////////////////////////////////////////////////////////

ACTOR MiniGun : BrutalWeapon Replaces Chaingun
{
	Game Doom
	SpawnID 28
	Weapon.SelectionOrder 700
	Weapon.AmmoType1 "Clip2"
	Weapon.AmmoGive 0
	Weapon.AmmoUse1 1
	Weapon.PreferredSkin "Minigun Marine"
	+WEAPON.NOAUTOAIM
	+WEAPON.NOAUTOFIRE
	+FORCEXYBILLBOARD
	Inventory.PickupSound "CBOXPKUP"
	Inventory.ForbiddenTo Corvus
	Inventory.PickupMessage "You got the Minigun!"
	Obituary "%o was mowed down by %k's Minigun."
	AttackSound "none"
	Scale 0.9
	States
	{
	Spawn:
		MGUN A -1
		Stop
	 
	GoingToReady:
		TNT1 A 1
		Goto Ready
	
	Select:		
		CPGS A 0 A_JumpIfInventory("IsPaladin",1,3)
		CHGS A 0
		"####" AAAAAAAAAAAA 0 A_Raise
		"####" ABCD 1 A_Raise
		"####" A 0 A_PlaySound("CHGNPKUP")
		Goto Super::Select
	
	Deselect:
		CPGS A 0 A_JumpIfInventory("IsPaladin",1,3)
		CMGS A 0 A_JumpIfInventory("IsSorcerer",1,2)
		CHGS A 0
		"####" A 0 A_TakeInventory("Spin",1)
		"####" A 0 SetPlayerProperty(0,0,0)
		"####" A 1 A_Lower
		Wait
	
	SpellFlash:
		CMGS FEDDCCBBBAAAAAAAAABCCDDEEFFF 1 
		stop
			
	Ready:
	ReadyLoop:
		CHPG A 0 A_JumpIfInventory("IsPaladin",1,3)
		CHMG A 0 A_JumpIfInventory("IsSorcerer",1,2)
		CHAG A 0
		"####" A 0 A_SetCrosshair(42)
		"####" A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		"####" A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		"####" A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		"####" A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		"####" A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		"####" A 0 A_JumpIfInventory("Quickspell",1,"Quickspell")
		"####" A 2 A_WeaponReady
		"####" A 0 A_JumpIfInventory("Spin",1,"Ready2")
		Loop

	Ready2:
		CHPG A 0 A_JumpIfInventory("IsPaladin",1,3)
		CHMG A 0 A_JumpIfInventory("IsSorcerer",1,2)
		CHAG A 0
		"####" A 0 A_SetCrosshair(43)
		"####" A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		"####" A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		"####" A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		"####" ABCD 1 A_WeaponReady
		"####" A 0 A_PlaySound("Chaingun/Spin")
		Loop

    NoAmmo:
        MNGG A 10 A_PlaySound("weapons/empty")
        Goto ReadyLoop

	Fire:
		CHPG A 0 A_JumpIfInventory("IsPaladin",1,3)
		CHMG A 0 A_JumpIfInventory("IsSorcerer",1,2)
		CHAG A 0
		"####" A 0 A_JumpIfInventory("Spin",1,"Fire2")
		"####" A 0 A_PlaySound("Chaingun/Start")
		"####" A 0 BRIGHT A_FireCustomMissile("Alerter")
		"####" BC 2
		"####" D 1
    Hold:
		CHPF A 0 A_JumpIfInventory("IsPaladin",1,3)
		CHMF A 0 A_JumpIfInventory("IsSorcerer",1,2)
		CHAF A 0
		"####" A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		"####" A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		"####" A 0 A_JumpIfInventory("Spin",1,"Fire2")
        "####" A 0 A_PlaySound("Chaingun/fire")
        "####" A 0 A_Recoil(0.1)
		"####" A 0 A_SetAngle(frandom(0.5, -0.5) + angle)
		"####" A 0 A_SetPitch(-1 + pitch)
		"####" A 0 A_FireCustomMissile("ShakeYourAss", 0, 0, 0, 0)
		"####" A 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,0)
        "####" A 0 BRIGHT A_FireBullets(3, 3, 1, 16, "HitPuff", 1)
        "####" A 0 BRIGHT A_FireCustomMissile("DecorativeTracer", random(-3,3), 0, -1, random(-3,3))
		"####" A 1 BRIGHT A_SpawnItemEx("PlayerMuzzle1",30,5,25)
        "####" A 0 A_Firecustommissile("50CaseSpawn",0,0,-12,-18)
        "####" BC 1 //A_FireCustomMissile("SmokeSpawner11",0,0,0,0)
		"####" A 0 A_PlaySound("Chaingun/fire")
        "####" A 0 A_Recoil(0.1)
		"####" A 0 A_FireCustomMissile("ShakeYourAss", 0, 0, 0, 0)
		"####" A 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,0)
        "####" D 0 BRIGHT A_FireBullets(3, 3, 1, 16, "MiniGunBulletPuff", 1)
        "####" A 0 BRIGHT A_FireCustomMissile("DecorativeTracer", random(-3,3), 0, -1, random(-3,3))
		"####" D 1 BRIGHT A_SpawnItemEx("PlayerMuzzle1",30,5,25)
        "####" A 0 A_Firecustommissile("50CaseSpawn",0,0,-12,-18)
        "####" EF 1 //A_FireCustomMissile("SmokeSpawner11",0,0,0,0)
		"####" A 0 A_PlaySound("Chaingun/fire")
		"####" A 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,0)
        "####" G 0 BRIGHT A_FireBullets(3, 3, 1, 16, "HitPuff", 1)
        "####" A 0 BRIGHT A_FireCustomMissile("DecorativeTracer", random(-3,3), 0, -1, random(-3,3))
		"####" G 1 BRIGHT A_SpawnItemEx("PlayerMuzzle1",30,5,25)
        "####" A 0 A_Firecustommissile("50CaseSpawn",0,0,-12,-18)
        "####" HI 1 //A_FireCustomMissile("SmokeSpawner11",0,0,0,0)
        "####" A 0 A_ReFire
		"####" A 0 A_JumpIfInventory("Spin",1,"Ready2")
		"####" A 0 A_PlaySound("Chaingun/Stop")
		"####" A 0 A_WeaponReady
		"####" A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		"####" A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		"####" A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		"####" A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		"####" A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		CHPG A 0 A_JumpIfInventory("IsPaladin",1,3)
		CHMG A 0 A_JumpIfInventory("IsSorcerer",1,2)
		CHAG A 0
		"####" ABCD 1 //A_FireCustomMissile("SmokeSpawner11",0,0,0,0)
		"####" A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		"####" A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		"####" A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		"####" ABCD 1 //A_FireCustomMissile("SmokeSpawner11",0,0,0,0)
		"####" A 0 A_Refire
		"####" A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		"####" A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		"####" A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		"####" ABCD 2 //A_FireCustomMissile("SmokeSpawner11",0,0,0,0)
		goto ReadyLoop

	Fire2:
		CHPF A 0 A_JumpIfInventory("IsPaladin",1,3)
		CHMF A 0 A_JumpIfInventory("IsSorcerer",1,2)
		CHAF A 0
		"####" A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		"####" A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		"####" A 0 A_PlaySound("Chaingun/fire")
		"####" A 0 A_FireCustomMissile("ShakeYourAss", 0, 0, 0, 0)
		"####" A 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,0)
		"####" A 0 A_SetAngle(random(2, -2) + angle)
		"####" A 0 A_SetPitch(-1 + pitch)
		"####" A 0 BRIGHT A_FireBullets(3, 3, -1, 16, "MiniGunBulletPuff", 1)
		"####" A 0 BRIGHT A_FireCustomMissile("DecorativeTracer", random(-3,3), 0, -1, random(-3,3))
		"####" A 1 BRIGHT A_SpawnItemEx("PlayerMuzzle1",30,5,25)
		"####" A 0 A_Firecustommissile("50CaseSpawn",0,0,-12,-18)
		"####" B 1 //A_FireCustomMissile("SmokeSpawner11",0,0,0,0)
		"####" A 0 A_SetAngle(random(2, -2) + angle)
		"####" A 0 A_PlaySound("Chaingun/fire")
		"####" A 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,0)
		"####" A 0 BRIGHT A_FireBullets(3, 3, -1, 16, "MiniGunBulletPuff", 1)
		"####" A 0 BRIGHT A_FireCustomMissile("DecorativeTracer", random(-3,3), 0, -1, random(-3,3))
		"####" G 1 BRIGHT A_SpawnItemEx("PlayerMuzzle1",30,5,25)
		"####" A 0 A_Firecustommissile("50CaseSpawn",0,0,-12,-18)
		"####" H 1
		"####" A 0 A_ReFire
		CHPG A 0 A_JumpIfInventory("IsPaladin",1,3)
		CHMG A 0 A_JumpIfInventory("IsSorcerer",1,2)
		CHAG A 0
		"####" A 1 A_WeaponReady
		"####" B 1 A_WeaponReady
		"####" C 1 A_WeaponReady
		"####" D 1 A_WeaponReady
        goto Ready2
		
	AltFire:
		"####" A 0 A_JumpIfInventory("Spin",1,"StopAlt")
		"####" A 0 A_GiveInventory ("Spin",1)
		"####" A 0 A_PlaySound("Chaingun/Start")
		CHPG A 0 A_JumpIfInventory("IsPaladin",1,3)
		CHMG A 0 A_JumpIfInventory("IsSorcerer",1,2)
		CHAG A 0
		"####" ABCD 2
		Goto Ready2

	StopAlt:
		CHPG A 0 A_JumpIfInventory("IsPaladin",1,3)
		CHMG A 0 A_JumpIfInventory("IsSorcerer",1,2)
		CHAG A 0
		"####" A 0 A_TakeInventory ("Spin",1)
		"####" A 0 A_PlaySound("Chaingun/Stop")
		"####" ABCD 1
		"####" ABCD 2
		Goto ReadyLoop
	TossGrenade:	
		"####" A 0
		"####" A 0 A_TakeInventory("TossGrenade", 1)
		"####" A 0 A_JumpIfInventory("GrenadeAmmo", 1, 1)
		Goto NoGrenade
		WTFL A 0 A_JumpIfInventory("IsPaladin",1,"PallyGrenadeToss")
		GRTH ABCD 1
		"####" A 0 A_GiveInventory("FiredGrenade", 1)
		"####" A 0 A_PLaySound ("GRNPIN")
		GRTH EEFG 1
		"####" A 0 A_PLaySound ("GRNTOSS")
		GRTH HI 1
		"####" A 0 A_TakeInventory("GrenadeAmmo", 1)
		"####" A 0 A_FireCustomMissile("HandGrenade", random(-2,2), 0, 0, 0, 0, 0)
	    "####" A 0 A_TakeInventory("FiredGrenade", 1)
		GRTH JKLM 1
		"####" A 1 
		"####" A 0 A_TakeInventory("TossGrenade", 1)
		Goto Ready	
	NoGrenade:
		"####" A 0
		"####" A 0 A_Print("No Grenades Left.")
		Goto ReadyLoop
	PallyGrenadeToss:
		TNT1 A 0 A_GiveInventory("FiredGrenade", 1)
		TNT1 A 0 A_PLaySound ("GRNPIN")
		TNT1 A 4 //wait a moment
		WTFL ABCDEF 1
		TNT1 A 0 A_PLaySound ("GRNTOSS")
		TNT1 A 0 A_TakeInventory("GrenadeAmmo", 1)
		TNT1 A 0 A_FireCustomMissile("HandGrenade", random(-2,2), 0, 0, 0, 0, 0)
	    TNT1 A 0 A_TakeInventory("FiredGrenade", 1)
		WTFL GHIJKL 1
		Goto Ready
	}
}